

import '../../network/http_entity.dart';
class VideoListEntity {
  VideoListEntity({
      this.list, 
      this.pageCurrent, 
      this.pageSize, 
      this.total, 
      this.hasNext, 
      this.pages,});

  VideoListEntity.fromJson(dynamic json) {
    // if (json['list'] != null) {
    //   list = [];
    //   json['list'].forEach((v) {
    //     list?.add(VideoEntity.fromJson(v));
    //   });
    // }
    list = [];
    HttpEntity httpEntity = json;
    httpEntity.getData().forEach((v) {
      list?.add(VideoEntity.fromJson(v));
    });
    pageCurrent = httpEntity.oriData['pageCurrent'];
    pageSize = httpEntity.oriData['pageSize'];
    total = httpEntity.oriData['total'];
    hasNext = httpEntity.oriData['hasNext'];
    pages = httpEntity.oriData['pages'];
  }
  List<VideoEntity>? list;
  int? pageCurrent;
  int? pageSize;
  int? total;
  bool? hasNext;
  int? pages;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (list != null) {
      map['list'] = list?.map((v) => v.toJson()).toList();
    }
    map['pageCurrent'] = pageCurrent;
    map['pageSize'] = pageSize;
    map['total'] = total;
    map['hasNext'] = hasNext;
    map['pages'] = pages;
    return map;
  }

}

class VideoEntity {
  VideoEntity({
      this.id, 
      this.userId, 
      this.nickName, 
      this.avatar, 
      this.deleted, 
      this.createTime, 
      this.updateTime, 
      this.likesCount, 
      this.commentCount, 
      this.title, 
      this.imgUrl, 
      this.url,});

  VideoEntity.fromJson(dynamic json) {
    id = json['id'];
    userId = json['userId'];
    nickName = '萱萱';
    avatar = json['avatar'];
    deleted = json['deleted'];
    createTime = json['createTime'];
    updateTime = json['updateTime'];
    // likesCount = json['likesCount'];
    likesCount = 999;
    commentCount = 999;
    title = json['filename'];
    imgUrl = json['videoCover'];
    // imgUrl = json['imgUrl'];
    url = json['url'];
  }
  String? id;
  int? userId;
  String? nickName;
  dynamic avatar;
  int? deleted;
  int? createTime;
  int? updateTime;
  int? likesCount;
  int? commentCount;
  String? title;
  String? imgUrl;
  String? url;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['userId'] = userId;
    map['nickName'] = nickName;
    map['avatar'] = avatar;
    map['deleted'] = deleted;
    map['createTime'] = createTime;
    map['updateTime'] = updateTime;
    map['likesCount'] = likesCount;
    map['commentCount'] = commentCount;
    map['title'] = title;
    map['imgUrl'] = imgUrl;
    map['videoUrl'] = url;
    return map;
  }

}